package com.lxu.web;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.Serializable;

@RestController
@RequestMapping("/index")
public class IndexController {

    @RequestMapping("/query")
    public String index(){
        return "999999999";
    }

    @PostMapping("/testXssForm")
    @ApiOperation(value = "测试放开游客页面接口xssForm", notes = "测试放开游客页面接口xssForm", response = String.class)
    public String testXss(TestXssFormParam testXssFormParam) {
        // from 不好使
        return testXssFormParam.getTestStr();
    }

    @PostMapping("/testXssJson")
    @ApiOperation(value = "测试放开游客页面接口xssJson", notes = "测试放开游客页面接口xssJson", response = String.class)
    public String testXssJson(@Validated @RequestBody TestXssFormParam testXssFormParam) {
        return testXssFormParam.getTestStr();
    }

    @Data
    @Accessors(chain = true)
    @ApiModel(value = "testXss参数")
    public static class TestXssFormParam implements Serializable {

        private static final long serialVersionUID = 1L;

        @ApiModelProperty("testStr")
        private String testStr;
    }


}
